package com.example.tiptravel.presenter.post;

import com.example.tiptravel.entity.post.PostBean;
import com.example.tiptravel.model.ModelFactory;
import com.example.tiptravel.view.impl.post.PostView;

import rx.Subscriber;

/**
 * Created by 张稳 on 2016/11/10.
 */

public class PostPresenter {
    private PostView postView;

    public PostPresenter(PostView postView) {
        this.postView = postView;
    }

    public void getPostData() {
        ModelFactory.getiPostModel().getPostData(new Subscriber<PostBean>() {
            @Override
            public void onCompleted() {
                postView.onComplete();
            }

            @Override
            public void onError(Throwable e) {
                postView.onFailure(e);
            }

            @Override
            public void onNext(PostBean postBean) {
                postView.onSuccess(postBean);
            }
        });
    }
}
